
<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;

$indexes = array (
	task_title=>array (label=>"Task Title",order=>"DEFAULT",wrapper=>"vmc_icon_task"),
	date_begin=>array (label=>"Date Begin",order=>"DEFAULT",wrapper=>"vmc_icon_time_in"),
	date_end=>array (label=>"Date End",order=>"DEFAULT",wrapper=>"vmc_icon_time_out"),
	total_time=>array (label=>"Total Time",order=>"DEFAULT",wrapper=>"vmc_icon_total_time"),
);

$object_ctl = "/admin/projects/projects/fs_projects.php?fs_tab=users&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_users&fs_action=view&fs_tab_users=main&fs_tab_option_users=fs_timer&user_id={$_REQUEST["user_id"]}&";
$link_options = "&fs_tab=users&project_id={$_REQUEST["project_id"]}&fs_tab_option=fs_users&fs_action=view&fs_tab_users=main&user_id={$_REQUEST["user_id"]}";
$list_options = array ();

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
                db_conn=>$_GLOBAL_DBH,
                indexes=>$indexes,
		list_count=>"SELECT COUNT(*) FROM project_task_timer WHERE user_id={$_REQUEST["user_id"]}",
		list_select=>"SELECT project_task_timer.*,
				project_tasks.title AS task_title,
			SEC_TO_TIME(
				CASE project_task_timer.date_end
					WHEN '' THEN UNIX_TIMESTAMP()
					ELSE UNIX_TIMESTAMP(project_task_timer.date_end)
				END - UNIX_TIMESTAMP(project_task_timer.date_begin)
			) AS total_time,
			CASE project_task_timer.date_end
				WHEN '' THEN CURRENT_TIMESTAMP()
				ELSE project_task_timer.date_end
			END AS date_end
		FROM project_task_timer,project_tasks
		WHERE project_task_timer.user_id={$_REQUEST["user_id"]}
		AND project_task_timer.task_id=project_tasks.id",
                list_id=>"lc_project_user_timer",
                list_options=>$list_options,
                primary_key=>"id",
                primary_relation=>"timer_id",
                link_options=>$link_options,
                object_ctl=>$object_ctl
));

$_OBJECT_IFACE_TABBING_PANEL->insert_container ($_OBJECT_IFACE_LIST);

?>
